﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lidgren.Network;

namespace SharedLib.Network.Client
{
    public class ClientProperties
    {
        public static ClientProperties Instance;
        public ClientWorld WorldManager;
        public ClientLocalPlayer Player;

        public NetClient Client;
        public ClientListener ClientListener;
        public ClientSender ClientSender;
        public NetIncomingMessage _msgBuffer;

        public ClientState State = ClientState.Init;

        public bool WireMode;

        public Dictionary<String, Object> ObjectsBox;

        public ClientProperties( String IP, String playerName)
        {

            Instance = this;

            NetPeerConfiguration netconfig = new NetPeerConfiguration(Constants.REMOTE_SERVICE_NAME);   
            Client = new NetClient(netconfig);
            Client.Start();


            ObjectsBox = new Dictionary<string, object>();

            Player = new SharedLib.Network.Client.ClientLocalPlayer();
            Player.Name = playerName;

            WorldManager = new ClientWorld(this);
            ClientListener = new ClientListener(Client, this);
            ClientSender = new ClientSender(Client, this);

            State = ClientState.InLogin;

            ClientSender.SendJoinGame(IP);
        }
    }
}
